package a.f.g.a;

import a.a.qb;
import a.d.w;
import a.f.o;

public class e
  extends d
{
  private static final double R = 0.9D;
  private static final int S = 50;
  private boolean T;
  private double U = 0.9D;
  private long V;
  private long W;
  private long X;
  private boolean Y;
  private boolean Z;
  private final Object ab = new Object();
  private long bb;
  private db cb = new fc();
  private boolean db;
  private boolean eb;
  private boolean fb;
  private final Object gb = new Object();
  private boolean hb = true;
  private long ib;
  private long jb;
  private int kb;
  private long lb;
  private long mb = 1L;
  public static int nb;
  
  public e()
  {
    this(true);
  }
  
  public e(boolean paramBoolean)
  {
    super(paramBoolean);
    z localz = new z();
    a(localz);
  }
  
  public void a(o paramo)
  {
    this.bb = System.currentTimeMillis();
    synchronized (this.gb)
    {
      if (!xb.r) {
        if (this.fb) {
          return;
        }
      }
    }
    j(false);
    this.V = 0L;
    this.W = 0L;
    super.a(paramo);
  }
  
  public void doLayout(o paramo)
  {
    this.bb = System.currentTimeMillis();
    synchronized (this.gb)
    {
      if (!xb.r)
      {
        if (this.fb)
        {
          this.eb = false;
          this.db = true;
          this.gb.notifyAll();
          return;
        }
        this.eb = true;
        this.db = false;
      }
    }
    try
    {
      super.doLayout(paramo);
    }
    finally
    {
      synchronized (this.gb)
      {
        this.eb = false;
        this.db = true;
        this.gb.notifyAll();
      }
    }
  }
  
  private void W()
  {
    if ((xb.r) || (this.V * (1.0D - this.U) > this.W + this.V))
    {
      long l = System.currentTimeMillis();
      try
      {
        Thread.sleep(50L);
      }
      catch (InterruptedException localInterruptedException)
      {
        qb.a();
      }
      finally
      {
        this.W += System.currentTimeMillis() - l;
      }
    }
  }
  
  protected boolean z()
  {
    boolean bool = xb.r;
    int i = xb.q;
    if (!bool) {
      if (gb()) {
        return true;
      }
    }
    if (!bool) {
      if (!this.cb.b())
      {
        if (bool) {
          break label64;
        }
        if (!this.cb.a()) {
          break label60;
        }
      }
    }
    return false;
    label60:
    label64:
    if (!bool) {
      if (!kb())
      {
        if (bool) {
          break label99;
        }
        if (X()) {
          return true;
        }
      }
    }
    label99:
    if (!bool) {
      if (T().a(B())) {
        if (!bool)
        {
          if (kb())
          {
            synchronized (this.ab)
            {
              this.Y = true;
              do
              {
                do
                {
                  for (;;)
                  {
                    if (!this.Y) {
                      break label172;
                    }
                    try
                    {
                      this.ab.wait();
                      if (bool) {
                        break label186;
                      }
                      if (i != 0) {
                        break label174;
                      }
                    }
                    catch (InterruptedException localInterruptedException)
                    {
                      qb.a();
                    }
                  }
                } while (bool);
              } while (i == 0);
            }
            if (!bool)
            {
              if (gb()) {
                return true;
              }
              ab();
            }
            if (bool) {
              break label218;
            }
            if (i == 0) {}
          }
          else
          {
            this.Y = true;
          }
        }
        else {
          return true;
        }
      }
    }
    label172:
    label174:
    label186:
    label218:
    return false;
  }
  
  private boolean X()
  {
    boolean bool = xb.r;
    if (!bool) {
      if (hb()) {
        return true;
      }
    }
    if (!bool) {
      if (this.kb > this.mb)
      {
        long l1 = this.ib + this.jb;
        long l2 = System.currentTimeMillis();
        a(l2, l1);
        this.kb = 0;
        this.lb = l2;
        if (!bool) {}
        return l2 >= l1;
      }
    }
    return false;
  }
  
  private void a(long paramLong1, long paramLong2)
  {
    if (!hb())
    {
      long l1 = (paramLong1 - this.lb) / this.kb;
      long l2 = paramLong2 - paramLong1;
      if ((xb.r) || ((l1 > 0L) && (l2 > 0L))) {
        this.mb = (l2 / l1 + 1L);
      }
    }
  }
  
  protected void b(int paramInt)
  {
    boolean bool = xb.r;
    super.b(paramInt);
    if (!bool) {
      if (this.cb.b())
      {
        this.cb.a(this.J);
        F();
      }
    }
    if ((bool) || (this.cb.a())) {
      this.cb.b(this.J);
    }
  }
  
  public void Y()
  {
    synchronized (this.ab)
    {
      if (!xb.r) {
        if (this.Y)
        {
          this.Y = false;
          this.ab.notifyAll();
        }
      }
    }
    this.bb = System.currentTimeMillis();
  }
  
  protected void v()
  {
    boolean bool = xb.r;
    if (!bool) {
      if (kb())
      {
        Z();
        super.v();
        if (bool) {
          break label38;
        }
        W();
        if (xb.q == 0) {
          return;
        }
      }
    }
    label38:
    this.kb += 1;
  }
  
  private void Z()
  {
    this.V += System.currentTimeMillis() - this.X;
    this.Z = false;
  }
  
  private void ab()
  {
    this.X = System.currentTimeMillis();
    this.Z = true;
  }
  
  public void a(db paramdb)
  {
    this.cb = paramdb;
  }
  
  public db bb()
  {
    return this.cb;
  }
  
  public void a(Runnable paramRunnable)
  {
    this.cb.a(paramRunnable);
  }
  
  public boolean cb()
  {
    return this.Z;
  }
  
  public void db()
  {
    synchronized (this.gb)
    {
      this.fb = true;
      this.T = true;
    }
    if ((xb.r) || (hb())) {
      Y();
    }
  }
  
  public void eb()
  {
    boolean bool = xb.r;
    int i = xb.q;
    db();
    label66:
    label67:
    synchronized (this.gb)
    {
      do
      {
        do
        {
          for (;;)
          {
            if (!this.eb) {
              break label66;
            }
            if ((bool) || (i != 0)) {
              break label67;
            }
            if (this.db) {
              break label66;
            }
            try
            {
              this.gb.wait();
            }
            catch (InterruptedException localInterruptedException) {}
          }
        } while (bool);
      } while (i == 0);
    }
  }
  
  public double fb()
  {
    return this.U;
  }
  
  public void c(double paramDouble)
  {
    this.U = paramDouble;
  }
  
  void j(boolean paramBoolean)
  {
    synchronized (this.gb)
    {
      this.T = paramBoolean;
    }
  }
  
  public boolean gb()
  {
    synchronized (this.gb)
    {
      return this.T;
    }
  }
  
  public boolean hb()
  {
    synchronized (this.ab)
    {
      return this.Y;
    }
  }
  
  public long ib()
  {
    return this.bb;
  }
  
  long jb()
  {
    return System.currentTimeMillis() - this.bb;
  }
  
  public boolean kb()
  {
    return this.hb;
  }
  
  public void k(boolean paramBoolean)
  {
    this.hb = paramBoolean;
  }
  
  public cb a(Object paramObject)
  {
    xb localxb = R();
    if (localxb == null) {
      return null;
    }
    return bb().c(localxb, paramObject);
  }
  
  public w a(a.c.e parame)
  {
    cb localcb = a(parame);
    if (!xb.r) {
      if (localcb == null) {
        try
        {
          return ((o)parame.g()).o(parame);
        }
        catch (Exception localException)
        {
          return null;
        }
      }
    }
    y localy = localcb.a();
    return new w(localy.d(), localy.f());
  }
  
  public i.c_ j(o paramo)
  {
    a_ locala_ = new a_(paramo);
    locala_.c();
    return locala_;
  }
  
  private class a_
    implements i.c_
  {
    private final o a;
    private int b;
    
    public a_(o paramo)
    {
      this.a = paramo;
    }
    
    public void c()
    {
      e.this.k(false);
      e.this.e(this.a);
      this.b = 0;
    }
    
    public void a(long paramLong)
    {
      e.this.jb = paramLong;
      e.this.ib = System.currentTimeMillis();
      e.this.lb = e.this.ib;
      this.b = e.this.a(this.b);
    }
    
    public void a()
    {
      e.this.db();
      e.this.f(this.a);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.g.a.e

 * JD-Core Version:    0.7.0.1

 */